﻿using System;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using prototype123.models;
using prototype123.data_access;

namespace prototype123.controllers
{
    class MaintainCourseRegController
    {
        //private student object
        //private course object


        // This method shall add a term item to the data base and return the term item added
        // Preconditions: We assume that all of the parameters have data filled in, except for possibly <textbook> if <using_package> is true.
        // Postconditions: the database will be updated with a new Term_Item
        public TermItem AddCourseReg(int stu_id, string course_id, string textbook, string teachertype, bool using_package = false)
        {
            // Check if the user is already taking the course this term (and hasn't been dropped already), or has taken (and passed) in a previous term

                // Check the CurrentStudent's TermItems to see if he has already take the course with the same <course_id>

                // TermItemDAO tiDAO = new TermItemDAO()

                // bool hasTaken = tiDAO.CheckCourseReg(stu_id, course_id, term_id);

                // if hasTaken == true, // Throw a UserHasAlreadyTaken excpetion if this happens

            // If the user has already taken the course, but has dropped it, load that course, and clear the DROPPED flag in the existing TERM_ITEM Record

                 // tiDAO.ReAddCourse(stu_id, course_id, term_id)

            // else If {

            // TermItem tm = new TermItem(course_id ,textbook, teachertype ,using_package);

            // TermItemDAO tiDAO = new TermItemDAO();

            // tiDAO.AddCourse(stu_id, tm, course_id, term_id); }

            return null;
            //return tm;

            
        }

        // Drops the Course with the specified <itemID> by marking its dropped flag as 1 in the database
        //note: possibly keep course registrations in a list, rather than bringing them in again
        public void DropCourse(int itemID)
        {
            // find course inthe TermItem db and set the DROPPED flag to be turned on

            // TermItemDAO tiDAO = new TermItemDAO();

            // tiDAO.DropCourse(itemID);

            //return null; // student no longer enrolled in course
        }

    }
}
